﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BaGiaDanhCuop
{
    public class OldWoman
    {
        public Texture2D Woman_Move_TT;
        public Texture2D Woman_Fighting_Fail_TT;
        public Texture2D Woman_Fighting_Strong_TT;
        public Texture2D Woman_Fighting_Mid_TT;
        public Texture2D Woman_Be_Cuffed_TT;
        public Texture2D Shadow_TT;

        public Animation Woman_Move_Animation;
        public Animation Woman_Fighting_Fail_Animation;
        public Animation Woman_Fighting_Strong_Animation;
        public Animation Woman_Fighting_Mid_Animation;
        public Animation Woman_Be_Cuffed_Animation;

        public int state;
        public int item, hearth, key, medicine, energydrink;
        public float statetime;

        public Vector2 position;

        public OldWoman(Texture2D move, Texture2D fail, Texture2D strong, Texture2D mid, Texture2D becuffed, Texture2D shadow, float x, float y, int state, int item)
        {
            position = new Vector2(x, y);
            
            //Texture2D
            this.Woman_Move_TT = move;
            this.Woman_Fighting_Fail_TT = fail;
            this.Woman_Fighting_Strong_TT = strong;
            this.Woman_Fighting_Mid_TT = mid;
            this.Woman_Be_Cuffed_TT = becuffed;
            this.Shadow_TT = shadow;
            
            //Animation
            Woman_Be_Cuffed_Animation = new Animation(position, Woman_Be_Cuffed_TT, new Microsoft.Xna.Framework.Point(5, 2));
            Woman_Be_Cuffed_Animation.animate(0.125f);
            Woman_Fighting_Fail_Animation = new Animation(position, Woman_Fighting_Fail_TT, new Microsoft.Xna.Framework.Point(5, 2));
            Woman_Fighting_Fail_Animation.animate(0.125f);
            Woman_Fighting_Mid_Animation = new Animation(position, Woman_Fighting_Mid_TT, new Microsoft.Xna.Framework.Point(6, 1));
            Woman_Fighting_Mid_Animation.animate(0.125f);
            Woman_Fighting_Strong_Animation = new Animation(position, Woman_Fighting_Strong_TT, new Microsoft.Xna.Framework.Point(6, 1));
            Woman_Fighting_Strong_Animation.animate(0.125f);
            Woman_Move_Animation = new Animation(position, Woman_Move_TT, new Microsoft.Xna.Framework.Point(5, 2));
            Woman_Move_Animation.animate(0.125f);
            
            //attributes
            this.state = state;
            this.item = item;
            this.statetime = 0;
            this.hearth = 3;
            this.key = 0;
            this.medicine = 0;
            this.energydrink = 0;
        }

        public void Draw(SpriteBatch batch)
        {

        }

        public void UpdateState()
        {
            if(state == GamePage.STATE_STRONG && Woman_Fighting_Strong_Animation.FrameIndex == 5){
                Woman_Fighting_Strong_Animation.PlayFromFrameIndex(0);
                state = GamePage.STATE_MOVE;
                GamePage.Power_Status = false;
                GamePage.PowerRectangle.Width = 0;
            }
            else if (state == GamePage.STATE_MID && Woman_Fighting_Mid_Animation.FrameIndex == 5)
            {
                Woman_Fighting_Mid_Animation.PlayFromFrameIndex(0);
                state = GamePage.STATE_MOVE;
                GamePage.Power_Status = false;
                GamePage.PowerRectangle.Width = 0;
            }       
        }
    }
}
